using System.IO;

namespace GamePlayConfig
{
    public class MonsterCfg : Config<MonsterCfg>,IBinaryDeserializable
    {
        public string Name { get; private set; }
        public byte Age { get; private set; }
        public int Skill { get; private set; }
        public int[] Array1 { get; private set; }
        public int[,] Array2 { get; private set; }
        public byte test { get; private set; }

        public void Deserialize(BinaryReader reader)
        {
            ID = reader.ReadInt32();
            Name = reader.ReadString();
            Age = reader.ReadByte();
            Skill = reader.ReadInt32();
            int len_Array1 = reader.ReadInt32();
            Array1 = new int[len_Array1];
            for (int i = 0; i < len_Array1; ++i)
            {
                Array1[i] = reader.ReadInt32();
            }
            int len1_Array2 = reader.ReadInt32();
            int len2_Array2 = reader.ReadInt32();
            Array2 = new int[len1_Array2,len2_Array2];
            for (int i = 0; i < len1_Array2; ++i)
            {
                for (int j = 0; j < len2_Array2; ++j)
                {
                    Array2[i,j] = reader.ReadInt32();
                }
            }
            test = reader.ReadByte();

        }

    }
}
